package com.tuoyu.peopletest.holder;

import android.content.Context;
import android.view.View;


import com.tuoyu.peopletest.scinterface.OnItemDataListener;

import androidx.recyclerview.widget.RecyclerView;

/**
 * recycleview 基础
 */

public abstract class BaseRvHolder<T> extends RecyclerView.ViewHolder {


    public Context context;
    public T data;
    public OnItemDataListener<T> mListener;

    public BaseRvHolder(Context context,View itemView) {
        super(itemView);
        this.context = context;

        initView(itemView);
    }


    public void setData(T data, int position) {
        this.data = data;
        //刷新数据
        refreshView(position);

    }


    public abstract void initView(View itemView);

    public abstract void refreshView(int position);

    public void setItemClickListener(OnItemDataListener<T> listener){
        this.mListener = listener;
    }

}
